home *** CD-ROM | disk | FTP | other *** search
- Path: erich.triumf.ca!bennett
- From: bennett@erich.triumf.ca (P.Bennett)
- Newsgroups: comp.sources.wanted,comp.lang.c,comp.unix.programmer
- Subject: Re: Seek unix2dos.c OR help with tr
- Date: 10 Mar 1996 22:43 PST
- Organization: TRIUMF: Tri-University Meson Facility
- Distribution: world
- Message-ID: <10MAR199622434233@erich.triumf.ca>
- References: <4i0946$7io@nuke.csu.net>
- NNTP-Posting-Host: ftp.triumf.ca
- News-Software: VAX/VMS VNEWS 1.50
-
- In article <4i0946$7io@nuke.csu.net>, mclean@futon.SFSU.EDU (Emmett Mclean) writes...
- >Hi,
- >
- >Does anyone have the source to a program
- >converting a unix file into dos format?
- >That is, each decimal 10 char is replaced
- >with a series of a 10 and 13.
- >
- >The equivalent syntax to tr would be fine
- >as well.
- >
- >I will be using it to download zipped binaries
- >files from a unix box.
-
- If you are transferring zipped (or other binary) files, you DO NOT want to
- change 0x10 to 0x10,0x13!! doing so will corrupt any binary file.
-
- This conversion is _only_ required for text files.
-
- >#include <stdio.h>
- >main(){
- >char c;
- >while(EOF!=(c=getchar())){
- > if(10==c)putchar(13);
-
- You should declare c as int, not char, since getchar() returns an int, and EOF
- is a negative int, outside the range that can be represented by a char.
-
- Peter Bennett VE7CEI | Vessels shall be deemed to be in sight
- Internet: bennett@triumf.ca | of one another only when one can be
- Packet: ve7cei@ve7kit.#vanc.bc.ca | observed visually from the other
- TRIUMF, Vancouver, B.C., Canada | ColRegs 3(k)
- GPS and NMEA info and programs: ftp://sundae.triumf.ca/pub/peter/index.html
- or: ftp://ftp-i2.informatik.rwth-aachen.de/pub/arnd/GPS/peter/index.html
-
-
-
-
-
-
-
-
-
-